<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<style>

table.table_1{
	width: 100%;
	cellpadding:4 ;
	cellspacing:1 ;
	align:"center";
	text-align: center;
	border-collapse:collapse;
}

table.table_1 td { 
	font-size:14px; 
	color: #4f6b72; 
} 

#div1,#div2{
    display:inline;
}
</style>
<script type="text/javascript" src="<%=basePath%>/plug-in/jquery/jquery.jqprint.js"></script>

<script>
  $(document).ready(function(){
      $('#type').val('${type}');
      $('#date1').val('${date1}');
      $('#date2').val('${date2}');
      $('#batchNo').val('${FBatchNo}');
});

</script>

<script language="javascript">

function printall(){
	
	$(".printdiv").jqprint(); 
}
function printview(){
	document.all.WebBrowser1.ExecWB(7,1);
}


</script>
<script>
	
	 //查询
    function domsearch(){
    	
    	if($('#date1').val() == ""){
    	  tip('请选择开始日期');
    	  $('#date1').focus();
		  return;
    	}
    	if($('#date2').val() == ""){
    	tip('请选择结束日期');
    	$('#date2').focus();
		  return;
    	}
    	
        var currTab = $('#maintabs').tabs('getSelected');       //获取选中的标签项
        var url = "qualityReportController.do?query&date1="+$('#date1').val()+ "&date2="+$('#date2').val() + "&type=" + $('#type').val() + "&batchNo=" + $('#batchNo').val(); //$(currTab.panel('options').content).attr('src');    //获取该选项卡中内容标签（iframe）的 src 属性
       
      
       
        /* 重新设置该标签 */
         $('#maintabs').tabs('update',{
            tab:currTab,
            options:{
                href:url
            }
       }) 
    }
    
    
    
     //打印
    function doexport(){
    	

        var currTab = $('#maintabs').tabs('getSelected');       //获取选中的标签项
        var url = "qualityReportController.do?export&date1="+$('#date1').val()+ "&date2="+$('#date2').val() + "&type=" + $('#type').val() + "&batchNo=" + $('#batchNo').val(); //$(currTab.panel('options').content).attr('src');    //获取该选项卡中内容标签（iframe）的 src 属性
       
        window.location.href = url;
        /* 重新设置该标签 */
      /*   $('#maintabs').tabs('update',{
            tab:currTab,
            options:{
                href:url
            }
       }) */
    }
</script>



<div class="easyui-layout" fit="true">
  <div region="center" style="padding:2px;" title="">
  
     <div id="departListtb" style="padding: 3px; height: 25px" class="datagrid-toolbar">
		<div name="searchColums">
		    
			<span style="display:-moz-inline-box;display:inline-block;">
			<span style="display:-moz-inline-box;display:inline-block;width: 80px;text-align:right;text-overflow:ellipsis;-o-text-overflow:ellipsis; overflow: hidden;white-space:nowrap; " title="时间">钢种：</span>
			<select name="type"  id="type" style="width: 80px;">
			  <option value="LZ">冷轧钢带</option>
			  <option value="DG">镀铬钢带</option>
			  <option value="BXG">不锈钢</option>
			</select>
			<span style="display:-moz-inline-box;display:inline-block;width: 80px;text-align:right;text-overflow:ellipsis;-o-text-overflow:ellipsis; overflow: hidden;white-space:nowrap; " title="时间">日期：</span>
			<input type="text" name="date1" id="date1" class="Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',onpicked:function() {setDate_new($dp.cal.getP('y','yyyy'),$dp.cal.getP('M','MM'),$dp.cal.getP('dd','dd'));} })" style="width: 100px">
			~
			<input type="text" name="date2" id="date2" class="Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',onpicked:function() {setDate_new($dp.cal.getP('y','yyyy'),$dp.cal.getP('M','MM'),$dp.cal.getP('dd','dd'));} })" style="width: 100px">
			</span>
			<span style="display:-moz-inline-box;display:inline-block;width: 80px;text-align:right;text-overflow:ellipsis;-o-text-overflow:ellipsis; overflow: hidden;white-space:nowrap; " title="卷号">卷号：</span>
			<input id="batchNo" name ="batchNo">
			<a href="#" class="easyui-linkbutton l-btn" iconcls="icon-search" onclick="domsearch()">
				<span >查询</span>
			</a>
			<a href="#" class="easyui-linkbutton l-btn" iconcls="icon-print" onclick="doexport()">
				<span >导出</span>
			</a>
			<a href="#" class="easyui-linkbutton l-btn" iconcls="icon-print" onclick="printall()">
				<span >打印</span>
			</a>
		</div>
	 </div>


    <div id="div1" class="datagrid-body printdiv" style="width: 50%;height: 100%;float: left" >
       <table class="table_1"  >
          <tr>
            <td colspan="7">成品质量报表</td>
          </tr>
          <tr>
            <td>
                                       日期
            </td>
            <td>
                                      检验总数（卷）
            </td>
            <td>
               A级
            </td>
               <td>
               B级
            </td>
               <td>
               C级
            </td>
            <td>
                                        二等品
            </td>
            <td>
                                      不合格
            </td>
          </tr>
          
       	  <c:forEach items="${maplist}" var="poVal" varStatus="stuts">
		  <tr class="datagrid-row">
			<td align="center"> <fmt:formatDate value='${poVal.FDate}' type="date" pattern="yyyy-MM-dd"/> </td>
			<td align="center" >${poVal.sum_js}</td>
			<td align="center" >${poVal.A}</td>
			<td align="center">${poVal.B}</td>
			<td align="center">${poVal.C}</td>
			<td align="center">${poVal.D}</td>
			<td align="center">${poVal.E}</td>
		</tr>
		</c:forEach>
		
		<tfoot>
		<tr>
		  <td>合计</td>
		  <td>${sum_js}</td>
		  <td>${sum_a}</td>
		  <td>${sum_b}</td>
		  <td>${sum_c}</td>
		  <td>${sum_d}</td>
		  <td>${sum_e}</td>
		</tr>
		</tfoot>
     </table>
       
    </div>
    
    <div id="div2" class="datagrid-body printdiv" style="width: 50%;height: 500px;float: left" >
        <table class="table_1" >
           <tr>
             <td rowspan="2">项目</td>
             <td colspan="2">C级品质量缺陷统计</td>
             <td colspan="2">二等品质量缺陷统计</td>
             <td colspan="2">不合格品质量缺陷统计</td>
           </tr>
           <tr>
              <td>项次</td>
              <td>频率</td>
              <td>项次</td>
              <td>频率</td>
              <td>项次</td>
              <td>频率</td>
           </tr>
           
           <c:forEach items="${maplist2}" var="poVal" varStatus="stuts">
		   <tr class="datagrid-row">
				<td align="center">${poVal.FQCItemName}  </td>
				<td align="center" >${poVal.C}</td>
				<td align="center" >${poVal.per_c}</td>
				<td align="center">${poVal.D}</td>
				<td align="center" >${poVal.per_d}</td>
				<td align="center">${poVal.E}</td>
				<td align="center">${poVal.per_e}</td>
		   </tr>
		   </c:forEach>
		   <tfoot>
		     <tr>
		       <td>合计</td>
		       <td>${sum_c1}</td>
		       <td></td>
		       <td>${sum_d1}</td>
		       <td></td>
		       <td>${sum_e1}</td>
		       <td></td>
		     </tr>
		   </tfoot>
        </table>
     </div>

  </div>
</div>